<header id="topbar" class="affix" style="top:60px;">
  <div class="topbar-left">
      <ol class="breadcrumb">
          <li class="crumb-active">
              <a href="#op/metis_order/">Metis电玩城订单</a>
          </li>
      </ol>
  </div>
      <div class="topbar-right">
          <a class="btn btn-default btn-sm light fw600 ml10" id="exportData"><span class="glyphicon glyphicon-cloud-download pr5"></span>导出数据</a>
        <div class="ml15 ib va-m" id="toggle_sidemenu_r">
            <a href="#" class="pl5"> <i class="fa fa-sign-in fs22 text-primary"></i>
            </a>
        </div>
      </div>
</header>

<section id="content" class="animated fadeIn">
  <% if(items.length > 0){ %>
  <div class="panel overflow">
      <table class="table table-striped fs13" id="main-list">
          <thead>
          <tr class="bg-light">
              <th>订单ID</th>
              <th>用户ID</th>
              <th>游戏类别</th>
              <th>玩法</th>
              <th>局号</th>
              <th>押注金额</th>
              <th>返还金额</th>
              <th class="sortable" data-field="create_time">购买时间</th>
          </tr>
          </thead>
          <tbody class="admin-form">
              <% var moment = require('moment'); %>
              <%
              var buyAmount = 0;
              var winAmount = 0;
              _.each(items, function(item){
                  buyAmount += parseFloat(item.bet_amount);
                  winAmount += parseFloat(item.bet_win);
              %>
          <tr data-uid="<%= item.id %>" data-id="<%= item.id %>">
              <td><a><%= item.ticket_id %></a></td>
              <td><a href="#stats/account/?id=<%= item.user_id %>"><%= item.user_id %></a></td>
              <td><%= window.replace_metis_game_name(item.game_id) %></td>
              <td><%= item.game_id === 5600 ? '':window.replace_metis_bet(item.game_id, item.play_type) %></td>
              <td><%= item.round_id %></td>
              <td><%= item.bet_amount %></td>
              <td><%= item.bet_win %></td>
              <td><%= item.create_time %></td>
          </tr>
          <%
          }) %>
          </tbody>
      </table>
  </div>
  <div><div class="pull-left" id="page-tips"></div>
      <span style="margin-left:20px;">本页累计投注金额：</span><span style="color:#F00"><%= (buyAmount).toFixed(3) %></span>
      <span style="margin-left:20px;">本页累计返还金额：</span><span style="color:#F00"><%= (winAmount).toFixed(3) %></span>
      <span style="margin-left:20px;">总共投注金额：</span><span style="color:#F00"><%= (total_bet * 1).toFixed(3) %></span>
      <span style="margin-left:20px;">总共返还金额：</span><span style="color:#F00"><%= (total_win * 1).toFixed(3) %></span>
      <div id="paginator"></div>
  </div>
  <% }else{ %>
  <h4 class="text-muted">无数据</h4>
  <% } %>
</section>

<!-- Start: Right Sidebar -->
<aside id="sidebar_right" class="nano" style="top: 110px;">
  <div class="p20 admin-form">
      <h4 class="mt5 text-muted fw500">过滤条件：</h4>
      <h6 class="fw400">游戏类别</h6>
        <div class="section mb15">
            <label class="field select">
                <select id="searchGame" name="searchGame" data-field="game_id">
                        <option value="-1" <%= searched.game_id == -1 ? 'selected' : '' %>>所有</option>
                        <%    _.each(window.METIS_GAME_TYPE, function(v, k){   %>
                        <option value="<%= k %>" <%= searched.game_id == k ? 'selected' : '' %>> <%= v %> </option>
                    <%  });  %>
                </select>
                <i class="arrow double"></i>
            </label>
        </div>
      <hr class="short">
      <div class="section mb15">
          <label class="field prepend-icon">
              <input title="订单ID" type="text" id="searchId" class="gui-input" data-field="ticket_id" placeholder="订单ID"
                     value="<%= searched.ticket_id %>">
              <input title="用户ID" type="text" id="searchUid" class="gui-input" data-field="user_id" placeholder="用户ID"
                     value="<%= searched.user_id %>">
              <label class="field-icon"><i class="fa fa-tag"></i>
              </label>
          </label>
      </div>

      <h6 class="fw400">购买时间</h6>
      <div class="section row" id="searchCreatedAt">
          <div class="col-md-6">
              <input type="text" class="gui-input datetime-input" data-field="create_time.$gte" data-useless=""
                     placeholder=">=" value="<%= searched.create_time ? searched.create_time.$gte : '' %>">
          </div>
          <div class="col-md-6">
              <input type="text" class="gui-input datetime-input" data-field="create_time.$lte" data-useless=""
                     placeholder="<=" value="<%= searched.create_time ? searched.create_time.$lte : '' %>">
          </div>
      </div>

      <div class="row">
          <div class="col-md-6">
              <button class="btn btn-primary btn-block form-control" id="search">搜索</button>
          </div>
      </div>

  </div>
</aside>
<!-- End: Right Sidebar -->